home *** CD-ROM | disk | FTP | other *** search
- //-------------------------------------------------------------------//
-
- // Synopsis: An involutory matrix.
-
- // Syntax: A = invol ( N )
-
- // Description:
-
- // A is an N-by-N involutory (A*A = EYE(N)) and ill-conditioned
- // matrix. It is a diagonally scaled version of HILB(N).
-
- // NB: B = (EYE(M,N)-A)/2 and B = (EYE(N)+A)/2 are idempotent (B*B = B).
-
- // Reference:
- // A.S. Householder and J.A. Carpenter, The singular values
- // of involutory and of idempotent matrices, Numer. Math. 5 (1963),
- // pp. 234-237.
-
- // This file is a translation of invol.m from version 2.0 of
- // "The Test Matrix Toolbox for Matlab", described in Numerical
- // Analysis Report No. 237, December 1993, by N. J. Higham.
-
- //-------------------------------------------------------------------//
-
- invol = function ( n )
- {
- local (n)
-
- A = hilb(n);
-
- d = -n;
- A[;1] = d*A[;1];
-
- for (i in 1:n-1)
- {
- d = -(n+i)*(n-i)*d/(i*i);
- A[i+1;] = d*A[i+1;];
- }
- return A;
- };
-